QuickOPC User's Guide and Reference
Examples - User Interface - OPC Unified Architecture generic browsing dialog with multi-select

.NET

// This example shows how to let the user browse for multiple OPC-UA nodes.

using System.Windows.Forms;
using OpcLabs.EasyOpc.UA.Forms.Browsing;

namespace UAFormsDocExamples._UABrowseDialog
{
    static partial class ShowDialog
    {
        public static void MultiSelect(IWin32Window owner)
        {
            var browseDialog = new UABrowseDialog();
            browseDialog.InputsOutputs.CurrentNodeDescriptor.EndpointDescriptor.Host = "opcua.demo-this.com";
            browseDialog.Mode.AnchorElementType = UAElementType.Host;
            browseDialog.Mode.MultiSelect = true;

            DialogResult dialogResult = browseDialog.ShowDialog(owner);
            if (dialogResult != DialogResult.OK)
                return;

            // Display results
            UABrowseNodeElementCollection selectionElements = browseDialog.Outputs.SelectionElements;
            string text = "";
            for (int i = 0; i < selectionElements.Count; i++)
            {
                UABrowseNodeElement selectionElement = selectionElements[i];
                text += $"SelectionElements({i}): {selectionElement.NodeElement}\r\n";
            }
            MessageBox.Show(owner, text);
        }
    }
}
# This example shows how to let the user browse for an OPC-UA node.

# The QuickOPC package is needed. Install it using "pip install opclabs_quickopc".
import opclabs_quickopc

# Import .NET namespaces.
from System.Windows.Forms import *
from OpcLabs.EasyOpc.UA.Forms.Browsing import *


browseDialog = UABrowseDialog()
browseDialog.InputsOutputs.CurrentNodeDescriptor.EndpointDescriptor.Host = 'opcua.demo-this.com'
browseDialog.Mode.AnchorElementType = UAElementType.Host

dialogResult = browseDialog.ShowDialog()
print(dialogResult)
if dialogResult != DialogResult.OK:
    exit()

# Display results.
print(browseDialog.Outputs.CurrentNodeElement.NodeElement)

print('Finished.')

COM

Rem This example shows how to let the user browse for multiple OPC-UA nodes.

Option Explicit

Const DialogResult_OK = 1

Const UAElementType_Host = 1

Dim BrowseDialog: Set BrowseDialog = CreateObject("OpcLabs.EasyOpc.UA.Forms.Browsing.UABrowseDialog")
BrowseDialog.InputsOutputs.CurrentNodeDescriptor.EndpointDescriptor.Host = "opcua.demo-this.com"
BrowseDialog.Mode.AnchorElementType = UAElementType_Host
BrowseDialog.Mode.MultiSelect = True


Dim dialogResult: dialogResult = BrowseDialog.ShowDialog
WScript.Echo dialogResult

If dialogResult <> DialogResult_OK Then
    WScript.Quit
End If

' Display results
Dim SelectionElements: Set SelectionElements = BrowseDialog.Outputs.SelectionElements
Dim i: For i = 0 To SelectionElements.Count - 1
    Dim Element: Set Element = SelectionElements(i)
    WScript.Echo "SelectionElements(" & i & "): " & Element.NodeElement
Next

 

See Also

Conceptual